using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using PickGold.Charting;
using PickGold.Charting.Utilities;

namespace PickGold.Charting.ChartTypes
{
	internal class StackedColumnChart : IChartType, IDisposable
	{
		internal string currentStackGroup = string.Empty;
		protected bool hundredPercentStacked;
		protected double prevNegY = double.NaN;
		protected double prevPosY = double.NaN;
		internal ArrayList stackGroupNames;
		internal bool stackGroupNameUsed;

		public void AddSmartLabelMarkerPositions(CommonElements common, ChartArea area, Series series, ArrayList list)
		{
		}

		public void Dispose()
		{
			this.Dispose(true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
		}

		public void DrawLabels(CommonElements common, ChartGraphics graph, ChartArea area, DataPoint point, int pointIndex, Series series, RectangleF rectangle)
		{
			using (StringFormat format = new StringFormat())
			{
				format.Alignment = StringAlignment.Center;
				format.LineAlignment = StringAlignment.Center;
				Region clip = graph.Clip;
				graph.Clip = new Region();
				if (point.IsValueShownAsLabel || (point.Label.Length > 0))
				{
					string str;
					if (point.Label.Length == 0)
					{
						double num = this.GetYValue(common, area, series, point, pointIndex, 0);
						if (this.hundredPercentStacked && (point.LabelFormat.Length == 0))
						{
							num = Math.Round(num, 2);
						}
						str = ValueConverter.FormatValue(series.Chart, point, point.Tag, num, point.LabelFormat, series.YValueType, ChartElementType.DataPoint);
					}
					else
					{
						str = point.ReplaceKeywords(point.Label);
					}
					PointF empty = PointF.Empty;
					empty.X = rectangle.X + (rectangle.Width / 2f);
					empty.Y = rectangle.Y + (rectangle.Height / 2f);
					int labelAngle = point.LabelAngle;
					if (str.Trim().Length != 0)
					{
						SizeF labelSize = SizeF.Empty;
						if (series.SmartLabelStyle.Enabled)
						{
							labelSize = graph.GetRelativeSize(graph.MeasureString(str, point.Font, new SizeF(1000f, 1000f), StringFormat.GenericTypographic));
							bool isMarkerOverlappingAllowed = series.SmartLabelStyle.IsMarkerOverlappingAllowed;
							LabelAlignmentStyles movingDirection = series.SmartLabelStyle.MovingDirection;
							series.SmartLabelStyle.IsMarkerOverlappingAllowed = true;
							if (series.SmartLabelStyle.MovingDirection == (LabelAlignmentStyles.BottomRight | LabelAlignmentStyles.BottomLeft | LabelAlignmentStyles.TopRight | LabelAlignmentStyles.TopLeft | LabelAlignmentStyles.Left | LabelAlignmentStyles.Right | LabelAlignmentStyles.Bottom | LabelAlignmentStyles.Top))
							{
								series.SmartLabelStyle.MovingDirection = LabelAlignmentStyles.Bottom | LabelAlignmentStyles.Top;
							}
							empty = area.smartLabels.AdjustSmartLabelPosition(common, graph, area, series.SmartLabelStyle, empty, labelSize, format, empty, new SizeF(0f, 0f), LabelAlignmentStyles.Center);
							series.SmartLabelStyle.IsMarkerOverlappingAllowed = isMarkerOverlappingAllowed;
							series.SmartLabelStyle.MovingDirection = movingDirection;
							labelAngle = 0;
						}
						if (!empty.IsEmpty)
						{
							PointF absolutePoint = graph.GetAbsolutePoint(empty);
							if (graph.TextRenderingHint != TextRenderingHint.AntiAlias)
							{
								absolutePoint.X = ((float)Math.Ceiling((double)absolutePoint.X)) + 1f;
								empty = graph.GetRelativePoint(absolutePoint);
							}
							if (labelSize.IsEmpty)
							{
								labelSize = graph.GetRelativeSize(graph.MeasureString(str, point.Font, new SizeF(1000f, 1000f), StringFormat.GenericTypographic));
							}
							RectangleF backPosition = RectangleF.Empty;
							SizeF ef3 = new SizeF(labelSize.Width, labelSize.Height);
							ef3.Height += labelSize.Height / 8f;
							ef3.Width += ef3.Width / ((float)str.Length);
							backPosition = new RectangleF(empty.X - (ef3.Width / 2f), (empty.Y - (ef3.Height / 2f)) - (labelSize.Height / 10f), ef3.Width, ef3.Height);
							using (Brush brush = new SolidBrush(point.LabelForeColor))
							{
								graph.DrawPointLabelStringRel(common, str, point.Font, brush, empty, format, labelAngle, backPosition, point.LabelBackColor, point.LabelBorderColor, point.LabelBorderWidth, point.LabelBorderDashStyle, series, point, pointIndex);
							}
						}
					}
				}
				graph.Clip = clip;
			}
		}

		internal void DrawLabels3D(CommonElements common, ChartGraphics graph, ChartArea area, DataPoint3D pointEx, int pointIndex, Series series, RectangleF rectangle)
		{
			DataPoint dataPoint = pointEx.dataPoint;
			using (StringFormat format = new StringFormat())
			{
				format.Alignment = StringAlignment.Center;
				format.LineAlignment = StringAlignment.Center;
				Region clip = graph.Clip;
				graph.Clip = new Region();
				if (dataPoint.IsValueShownAsLabel || (dataPoint.Label.Length > 0))
				{
					string str;
					if (dataPoint.Label.Length == 0)
					{
						double num = this.GetYValue(common, area, series, dataPoint, pointIndex, -2);
						if (this.hundredPercentStacked && (dataPoint.LabelFormat.Length == 0))
						{
							num = Math.Round(num, 2);
						}
						str = ValueConverter.FormatValue(series.Chart, dataPoint, dataPoint.Tag, num, dataPoint.LabelFormat, series.YValueType, ChartElementType.DataPoint);
					}
					else
					{
						str = dataPoint.ReplaceKeywords(dataPoint.Label);
					}
					PointF empty = PointF.Empty;
					empty.X = rectangle.X + (rectangle.Width / 2f);
					empty.Y = rectangle.Y + (rectangle.Height / 2f);
					Point3D[] points = new Point3D[] { new Point3D(empty.X, empty.Y, pointEx.zPosition + pointEx.depth) };
					area.matrix3D.TransformPoints(points);
					empty.X = points[0].X;
					empty.Y = points[0].Y;
					int labelAngle = dataPoint.LabelAngle;
					SizeF labelSize = SizeF.Empty;
					if (series.SmartLabelStyle.Enabled)
					{
						labelSize = graph.GetRelativeSize(graph.MeasureString(str, dataPoint.Font, new SizeF(1000f, 1000f), StringFormat.GenericTypographic));
						bool isMarkerOverlappingAllowed = series.SmartLabelStyle.IsMarkerOverlappingAllowed;
						LabelAlignmentStyles movingDirection = series.SmartLabelStyle.MovingDirection;
						series.SmartLabelStyle.IsMarkerOverlappingAllowed = true;
						if (series.SmartLabelStyle.MovingDirection == (LabelAlignmentStyles.BottomRight | LabelAlignmentStyles.BottomLeft | LabelAlignmentStyles.TopRight | LabelAlignmentStyles.TopLeft | LabelAlignmentStyles.Left | LabelAlignmentStyles.Right | LabelAlignmentStyles.Bottom | LabelAlignmentStyles.Top))
						{
							series.SmartLabelStyle.MovingDirection = LabelAlignmentStyles.Bottom | LabelAlignmentStyles.Top;
						}
						empty = area.smartLabels.AdjustSmartLabelPosition(common, graph, area, series.SmartLabelStyle, empty, labelSize, format, empty, new SizeF(0f, 0f), LabelAlignmentStyles.Center);
						series.SmartLabelStyle.IsMarkerOverlappingAllowed = isMarkerOverlappingAllowed;
						series.SmartLabelStyle.MovingDirection = movingDirection;
						labelAngle = 0;
					}
					if (!empty.IsEmpty)
					{
						if (labelSize.IsEmpty)
						{
							labelSize = graph.GetRelativeSize(graph.MeasureString(str, dataPoint.Font, new SizeF(1000f, 1000f), StringFormat.GenericTypographic));
						}
						RectangleF backPosition = RectangleF.Empty;
						SizeF ef3 = new SizeF(labelSize.Width, labelSize.Height);
						ef3.Height += labelSize.Height / 8f;
						ef3.Width += ef3.Width / ((float)str.Length);
						backPosition = new RectangleF(empty.X - (ef3.Width / 2f), (empty.Y - (ef3.Height / 2f)) - (labelSize.Height / 10f), ef3.Width, ef3.Height);
						using (Brush brush = new SolidBrush(dataPoint.LabelForeColor))
						{
							graph.DrawPointLabelStringRel(common, str, dataPoint.Font, brush, empty, format, labelAngle, backPosition, dataPoint.LabelBackColor, dataPoint.LabelBorderColor, dataPoint.LabelBorderWidth, dataPoint.LabelBorderDashStyle, series, dataPoint, pointIndex);
						}
					}
				}
				graph.Clip = clip;
			}
		}

		public virtual Image GetImage(ChartTypeRegistry registry)
		{
			return (Image)registry.ResourceManager.GetObject(this.Name + "ChartType");
		}

		public virtual LegendImageStyle GetLegendImageStyle(Series series)
		{
			return LegendImageStyle.Rectangle;
		}

		internal static Series[] GetSeriesByStackedGroupName(CommonElements common, string groupName, string chartTypeName, string chartAreaName)
		{
			ArrayList list = new ArrayList();
			foreach (Series series in common.DataManager.Series)
			{
				if (((string.Compare(series.ChartTypeName, chartTypeName, StringComparison.OrdinalIgnoreCase) == 0) && (chartAreaName == series.ChartArea)) && (series.IsVisible() && (GetSeriesStackGroupName(series) == groupName)))
				{
					list.Add(series);
				}
			}
			int num = 0;
			Series[] seriesArray = new Series[list.Count];
			foreach (Series series2 in list)
			{
				seriesArray[num++] = series2;
			}
			return seriesArray;
		}

		internal static string GetSeriesStackGroupName(Series series)
		{
			string str = string.Empty;
			if (series.IsCustomPropertySet("StackedGroupName"))
			{
				str = series["StackedGroupName"];
			}
			return str;
		}

		public virtual double GetYValue(CommonElements common, ChartArea area, Series series, DataPoint point, int pointIndex, int yValueIndex)
		{
			double naN = double.NaN;
			if (!area.Area3DStyle.Enable3D || (yValueIndex == -2))
			{
				return point.YValues[0];
			}
			if (yValueIndex == -1)
			{
				double crossing = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName).Crossing;
				naN = this.GetYValue(common, area, series, point, pointIndex, 0);
				if (naN >= 0.0)
				{
					if (!double.IsNaN(this.prevPosY))
					{
						crossing = this.prevPosY;
					}
				}
				else if (!double.IsNaN(this.prevNegY))
				{
					crossing = this.prevNegY;
				}
				return (naN - crossing);
			}
			this.prevPosY = double.NaN;
			this.prevNegY = double.NaN;
			foreach (Series series2 in common.DataManager.Series)
			{
				if (((string.Compare(series.ChartArea, series2.ChartArea, StringComparison.Ordinal) != 0) || (string.Compare(series.ChartTypeName, series2.ChartTypeName, StringComparison.OrdinalIgnoreCase) != 0)) || !series2.IsVisible())
				{
					continue;
				}
				string seriesStackGroupName = GetSeriesStackGroupName(series2);
				if (!this.stackGroupNameUsed || (seriesStackGroupName == this.currentStackGroup))
				{
					if (double.IsNaN(naN))
					{
						naN = series2.Points[pointIndex].YValues[0];
					}
					else
					{
						naN = series2.Points[pointIndex].YValues[0];
						if ((naN >= 0.0) && !double.IsNaN(this.prevPosY))
						{
							naN += this.prevPosY;
						}
						if ((naN < 0.0) && !double.IsNaN(this.prevNegY))
						{
							naN += this.prevNegY;
						}
					}
					if (string.Compare(series.Name, series2.Name, StringComparison.Ordinal) == 0)
					{
						return naN;
					}
					if (naN >= 0.0)
					{
						this.prevPosY = naN;
					}
					if (naN < 0.0)
					{
						this.prevNegY = naN;
					}
				}
			}
			return naN;
		}

		internal static bool IsSeriesStackGroupNameSupported(Series series)
		{
			if (((series.ChartType != SeriesChartType.StackedColumn) && (series.ChartType != SeriesChartType.StackedColumn100)) && ((series.ChartType != SeriesChartType.StackedBar) && (series.ChartType != SeriesChartType.StackedBar100)))
			{
				return false;
			}
			return true;
		}

		public virtual void Paint(ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw)
		{
			this.stackGroupNameUsed = true;
			RectangleF absoluteRectangle = graph.GetAbsoluteRectangle(area.PlotAreaPosition.ToRectangleF());
			float num = (float)Math.Ceiling((double)absoluteRectangle.Right);
			float num2 = (float)Math.Ceiling((double)absoluteRectangle.Bottom);
			absoluteRectangle.X = (float)Math.Floor((double)absoluteRectangle.X);
			absoluteRectangle.Width = num - absoluteRectangle.X;
			absoluteRectangle.Y = (float)Math.Floor((double)absoluteRectangle.Y);
			absoluteRectangle.Height = num2 - absoluteRectangle.Y;
			graph.SetClipAbs(absoluteRectangle);
			this.ProcessChartType(false, graph, common, area, true, false, seriesToDraw);
			this.ProcessChartType(false, graph, common, area, false, false, seriesToDraw);
			this.ProcessChartType(false, graph, common, area, false, true, seriesToDraw);
			graph.ResetClip();
		}

		private void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, bool shadow, bool labels, Series seriesToDraw)
		{
			bool flag = false;
			AxisType primary = AxisType.Primary;
			AxisType yAxisType = AxisType.Primary;
			string xSubAxisName = string.Empty;
			string ySubAxisName = string.Empty;
			for (int i = 0; i < common.DataManager.Series.Count; i++)
			{
				Series series = common.DataManager.Series[i];
				if (((string.Compare(series.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) == 0) && (series.ChartArea == area.Name)) && series.IsVisible())
				{
					if (i == 0)
					{
						primary = series.XAxisType;
						yAxisType = series.YAxisType;
						xSubAxisName = series.XSubAxisName;
						ySubAxisName = series.YSubAxisName;
					}
					else if (((primary != series.XAxisType) || (yAxisType != series.YAxisType)) || ((xSubAxisName != series.XSubAxisName) || (ySubAxisName != series.YSubAxisName)))
					{
						flag = true;
						break;
					}
				}
			}
			if (flag)
			{
				for (int j = 0; j < common.DataManager.Series.Count; j++)
				{
					Series series2 = common.DataManager.Series[j];
					if (((string.Compare(series2.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) == 0) && !(series2.ChartArea != area.Name)) && series2.IsVisible())
					{
						string seriesStackGroupName = GetSeriesStackGroupName(series2);
						seriesStackGroupName = "_X_" + series2.XAxisType.ToString() + series2.XSubAxisName + "_Y_" + series2.YAxisType.ToString() + series2.YSubAxisName + "__";
						series2["StackedGroupName"] = seriesStackGroupName;
					}
				}
			}
			this.stackGroupNames = new ArrayList();
			foreach (Series series3 in common.DataManager.Series)
			{
				if (((string.Compare(series3.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) == 0) && !(series3.ChartArea != area.Name)) && series3.IsVisible())
				{
					string item = GetSeriesStackGroupName(series3);
					if (!this.stackGroupNames.Contains(item))
					{
						this.stackGroupNames.Add(item);
					}
				}
			}
			if (area.Area3DStyle.Enable3D)
			{
				if (!shadow)
				{
					this.ProcessChartType3D(selection, graph, common, area, labels, seriesToDraw);
				}
			}
			else
			{
				string[] strArray = area.GetSeriesFromChartType(this.Name).ToArray();
				int numberOfPoints = common.DataManager.GetNumberOfPoints(strArray);
				bool flag2 = ChartHelper.IndexedSeries(common, strArray);
				for (int k = 0; k < numberOfPoints; k++)
				{
					for (int m = 0; m < this.stackGroupNames.Count; m++)
					{
						this.currentStackGroup = (string)this.stackGroupNames[m];
						int num6 = 0;
						double num7 = 0.0;
						double num8 = 0.0;
					Label_093B:
						foreach (Series series4 in common.DataManager.Series)
						{
							if ((((string.Compare(series4.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) != 0) || (series4.ChartArea != area.Name)) || (!series4.IsVisible() || (k >= series4.Points.Count))) || (GetSeriesStackGroupName(series4) != this.currentStackGroup))
							{
								goto Label_093B;
							}
							DataPoint point = series4.Points[k];
							point.positionRel = new PointF(float.NaN, float.NaN);
							Axis axis = area.GetAxis(AxisName.Y, series4.YAxisType, series4.YSubAxisName);
							Axis axis2 = area.GetAxis(AxisName.X, series4.XAxisType, series4.XSubAxisName);
							bool sameInterval = false;
							double interval = 1.0;
							if (!flag2)
							{
								if ((series4.Points.Count == 1) && (((series4.XValueType == ChartValueType.Date) || (series4.XValueType == ChartValueType.DateTime)) || ((series4.XValueType == ChartValueType.Time) || (series4.XValueType == ChartValueType.DateTimeOffset))))
								{
									List<string> seriesFromChartType = area.GetSeriesFromChartType(this.Name);
									area.GetPointsInterval(seriesFromChartType, axis2.IsLogarithmic, axis2.logarithmBase, true, out sameInterval);
									if (!double.IsNaN(axis2.majorGrid.GetInterval()) && (axis2.majorGrid.GetIntervalType() != DateTimeIntervalType.NotSet))
									{
										interval = ChartHelper.GetIntervalSize(axis2.minimum, axis2.majorGrid.GetInterval(), axis2.majorGrid.GetIntervalType());
									}
									else
									{
										interval = ChartHelper.GetIntervalSize(axis2.minimum, axis2.Interval, axis2.IntervalType);
									}
								}
								else
								{
									interval = area.GetPointsInterval(axis2.IsLogarithmic, axis2.logarithmBase);
								}
							}
							double num10 = series4.GetPointWidth(graph, axis2, interval, 0.8) / ((double)this.stackGroupNames.Count);
							if (!selection)
							{
								common.Chart.CallOnPrePaint(new ChartPaintEventArgs(series4, graph, common, area.PlotAreaPosition));
							}
							double yValue = this.GetYValue(common, area, series4, point, k, 0);
							if (num6 != 0)
							{
								if (yValue >= 0.0)
								{
									yValue += num7;
								}
								else
								{
									yValue += num8;
								}
							}
							bool flag4 = false;
							double num12 = yValue;
							yValue = axis.GetLogValue(yValue);
							if (!flag4 || !labels)
							{
								if (yValue > axis.ViewMaximum)
								{
									yValue = axis.ViewMaximum;
								}
								if (yValue < axis.ViewMinimum)
								{
									yValue = axis.ViewMinimum;
								}
							}
							double linearPosition = axis.GetLinearPosition(yValue);
							double axisValue = 0.0;
							if (num6 == 0)
							{
								if (flag4 && labels)
								{
									axisValue = 0.0;
								}
								else
								{
									axisValue = axis.Crossing;
								}
							}
							else if (this.GetYValue(common, area, series4, point, k, 0) >= 0.0)
							{
								axisValue = num7;
							}
							else
							{
								axisValue = num8;
							}
							double position = axis.GetPosition(axisValue);
							double xValue = point.XValue;
							if (flag2)
							{
								xValue = k + 1.0;
							}
							double num17 = axis2.GetPosition(xValue);
							if (this.stackGroupNames.Count > 1)
							{
								num17 = ((num17 - ((num10 * this.stackGroupNames.Count) / 2.0)) + (num10 / 2.0)) + (m * num10);
							}
							xValue = axis2.GetLogValue(xValue);
							RectangleF empty = RectangleF.Empty;
							try
							{
								empty.X = (float)(num17 - (num10 / 2.0));
								empty.Width = (float)num10;
								if (position < linearPosition)
								{
									empty.Y = (float)position;
									empty.Height = ((float)linearPosition) - empty.Y;
								}
								else
								{
									empty.Y = (float)linearPosition;
									empty.Height = ((float)position) - empty.Y;
								}
							}
							catch (OverflowException)
							{
								num6++;
								goto Label_093B;
							}
							point.positionRel = new PointF((float)num17, empty.Top);
							if (point.IsEmpty)
							{
								num6++;
								goto Label_093B;
							}
							if (common.ProcessModePaint)
							{
								bool flag5 = false;
								if ((((xValue < axis2.ViewMinimum) || (xValue > axis2.ViewMaximum)) || ((yValue < axis.ViewMinimum) && (axisValue < axis.ViewMinimum))) || ((yValue > axis.ViewMaximum) && (axisValue > axis.ViewMaximum)))
								{
									flag5 = true;
								}
								if (!flag5)
								{
									int shadowOffset = 0;
									if (shadow)
									{
										shadowOffset = series4.ShadowOffset;
									}
									if (!labels)
									{
										bool flag6 = false;
										if (((empty.X < area.PlotAreaPosition.X) || (empty.Right > area.PlotAreaPosition.Right)) || ((empty.Y < area.PlotAreaPosition.Y) || (empty.Bottom > area.PlotAreaPosition.Bottom)))
										{
											graph.SetClip(area.PlotAreaPosition.ToRectangleF());
											flag6 = true;
										}
										graph.StartHotRegion(point);
										if (!shadow || (shadowOffset != 0))
										{
											graph.FillRectangleRel(empty, !shadow ? point.Color : Color.Transparent, point.BackHatchStyle, point.BackImage, point.BackImageWrapMode, point.BackImageTransparentColor, point.BackImageAlignment, point.BackGradientStyle, !shadow ? point.BackSecondaryColor : Color.Transparent, point.BorderColor, point.BorderWidth, point.BorderDashStyle, series4.ShadowColor, shadowOffset, PenAlignment.Inset, shadow ? BarDrawingStyle.Default : ChartGraphics.GetBarDrawingStyle(point), true);
										}
										graph.EndHotRegion();
										if (flag6)
										{
											graph.ResetClip();
										}
									}
									else
									{
										this.DrawLabels(common, graph, area, point, k, series4, empty);
									}
								}
							}
							if ((common.ProcessModeRegions && !shadow) && !labels)
							{
								common.HotRegionsList.AddHotRegion(empty, point, series4.Name, k);
							}
							if (!selection)
							{
								common.Chart.CallOnPostPaint(new ChartPaintEventArgs(series4, graph, common, area.PlotAreaPosition));
							}
							if (axis.IsLogarithmic)
							{
								yValue = Math.Pow(axis.logarithmBase, yValue);
							}
							num6++;
							if (this.GetYValue(common, area, series4, point, k, 0) >= 0.0)
							{
								num7 = num12;
							}
							else
							{
								num8 = num12;
							}
						}
					}
				}
				if (flag)
				{
					for (int n = 0; n < common.DataManager.Series.Count; n++)
					{
						Series series5 = common.DataManager.Series[n];
						if (((string.Compare(series5.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) == 0) && (series5.ChartArea == area.Name)) && series5.IsVisible())
						{
							string str6 = GetSeriesStackGroupName(series5);
							int index = str6.IndexOf("__", StringComparison.Ordinal);
							if (index >= 0)
							{
								str6 = str6.Substring(index + 2);
							}
							if (str6.Length > 0)
							{
								series5["StackedGroupName"] = str6;
							}
							else
							{
								series5.DeleteCustomProperty("StackedGroupName");
							}
						}
					}
				}
			}
		}

		private void ProcessChartType3D(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, bool labels, Series seriesToDraw)
		{
			if (!labels || selection)
			{
				List<string> seriesNamesList = null;
				seriesNamesList = area.GetClusterSeriesNames(seriesToDraw.Name);
				ArrayList list2 = area.GetDataPointDrawingOrder(seriesNamesList, this, selection, COPCoordinates.Y | COPCoordinates.X, null, 0, false);
				bool flag = false;
				foreach (object obj2 in list2)
				{
					DataPoint3D pointd = (DataPoint3D)obj2;
					DataPoint dataPoint = pointd.dataPoint;
					Series series = dataPoint.series;
					this.currentStackGroup = GetSeriesStackGroupName(series);
					dataPoint.positionRel = new PointF(float.NaN, float.NaN);
					Axis axis = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName);
					Axis axis2 = area.GetAxis(AxisName.X, series.XAxisType, series.XSubAxisName);
					BarDrawingStyle barDrawingStyle = ChartGraphics.GetBarDrawingStyle(dataPoint);
					float topRightDarkening = 0.5f;
					float bottomLeftDarkening = 0.5f;
					bool flag2 = true;
					bool flag3 = false;
					for (int i = 0; i < seriesNamesList.Count; i++)
					{
						Series series2 = common.DataManager.Series[i];
						if ((flag2 && (pointd.index <= series2.Points.Count)) && (series2.Points[pointd.index - 1].YValues[0] != 0.0))
						{
							flag2 = false;
							if (series2.Name == series.Name)
							{
								bottomLeftDarkening = 0f;
							}
						}
						if (series2.Name == series.Name)
						{
							flag3 = true;
						}
						else if ((pointd.index <= series2.Points.Count) && (series2.Points[pointd.index - 1].YValues[0] != 0.0))
						{
							flag3 = false;
						}
					}
					if (flag3)
					{
						topRightDarkening = 0f;
					}
					if (((area.StackGroupNames != null) && (area.StackGroupNames.Count > 1)) && area.Area3DStyle.IsClustered)
					{
						string seriesStackGroupName = GetSeriesStackGroupName(series);
						bool flag4 = true;
						bool flag5 = false;
						foreach (string str2 in seriesNamesList)
						{
							Series series3 = common.DataManager.Series[str2];
							if (GetSeriesStackGroupName(series3) == seriesStackGroupName)
							{
								if ((flag4 && (pointd.index < series3.Points.Count)) && (series3.Points[pointd.index - 1].YValues[0] != 0.0))
								{
									flag4 = false;
									if (str2 == series.Name)
									{
										bottomLeftDarkening = 0f;
									}
								}
								if (str2 == series.Name)
								{
									flag5 = true;
								}
								else if ((pointd.index < series3.Points.Count) && (series3.Points[pointd.index - 1].YValues[0] != 0.0))
								{
									flag5 = false;
								}
							}
						}
						if (flag5)
						{
							topRightDarkening = 0f;
						}
					}
					double yValue = this.GetYValue(common, area, series, pointd.dataPoint, pointd.index - 1, 0);
					double logValue = yValue - this.GetYValue(common, area, series, pointd.dataPoint, pointd.index - 1, -1);
					yValue = axis.GetLogValue(yValue);
					logValue = axis.GetLogValue(logValue);
					if (logValue > axis.ViewMaximum)
					{
						topRightDarkening = 0.5f;
						logValue = axis.ViewMaximum;
					}
					else if (logValue < axis.ViewMinimum)
					{
						bottomLeftDarkening = 0.5f;
						logValue = axis.ViewMinimum;
					}
					if (yValue > axis.ViewMaximum)
					{
						topRightDarkening = 0.5f;
						yValue = axis.ViewMaximum;
					}
					else if (yValue < axis.ViewMinimum)
					{
						bottomLeftDarkening = 0.5f;
						yValue = axis.ViewMinimum;
					}
					double linearPosition = axis.GetLinearPosition(yValue);
					double num7 = axis.GetLinearPosition(logValue);
					RectangleF empty = RectangleF.Empty;
					try
					{
						empty.X = (float)(pointd.xPosition - (pointd.width / 2.0));
						empty.Width = (float)pointd.width;
						if (num7 < linearPosition)
						{
							float num8 = bottomLeftDarkening;
							bottomLeftDarkening = topRightDarkening;
							topRightDarkening = num8;
							empty.Y = (float)num7;
							empty.Height = ((float)linearPosition) - empty.Y;
						}
						else
						{
							empty.Y = (float)linearPosition;
							empty.Height = ((float)num7) - empty.Y;
						}
					}
					catch (OverflowException)
					{
						continue;
					}
					dataPoint.positionRel = new PointF((float)pointd.xPosition, empty.Top);
					if (!dataPoint.IsEmpty)
					{
						double num9 = pointd.indexedSeries ? ((double)pointd.index) : dataPoint.XValue;
						num9 = axis2.GetLogValue(num9);
						if ((((num9 >= axis2.ViewMinimum) && (num9 <= axis2.ViewMaximum)) && ((yValue >= axis.ViewMinimum) || (logValue >= axis.ViewMinimum))) && ((yValue <= axis.ViewMaximum) || (logValue <= axis.ViewMaximum)))
						{
							bool flag6 = false;
							if ((empty.Right > area.PlotAreaPosition.X) && (empty.X < area.PlotAreaPosition.Right))
							{
								if (empty.X < area.PlotAreaPosition.X)
								{
									empty.Width -= area.PlotAreaPosition.X - empty.X;
									empty.X = area.PlotAreaPosition.X;
								}
								if (empty.Right > area.PlotAreaPosition.Right)
								{
									empty.Width -= empty.Right - area.PlotAreaPosition.Right;
								}
								if (empty.Width < 0f)
								{
									empty.Width = 0f;
								}
								if ((empty.Height != 0f) && (empty.Width != 0f))
								{
									DrawingOperationTypes drawElement = DrawingOperationTypes.DrawElement;
									if (common.ProcessModeRegions)
									{
										drawElement |= DrawingOperationTypes.CalcElementPath;
									}
									graph.StartHotRegion(dataPoint);
									using (GraphicsPath path = graph.Fill3DRectangle(empty, pointd.zPosition, pointd.depth, area.matrix3D, area.Area3DStyle.LightStyle, dataPoint.Color, topRightDarkening, bottomLeftDarkening, dataPoint.BorderColor, dataPoint.BorderWidth, dataPoint.BorderDashStyle, barDrawingStyle, true, drawElement))
									{
										graph.EndHotRegion();
										if (flag6)
										{
											graph.ResetClip();
										}
										if (common.ProcessModeRegions && !labels)
										{
											common.HotRegionsList.AddHotRegion(path, false, graph, dataPoint, series.Name, pointd.index - 1);
										}
										if (dataPoint.IsValueShownAsLabel || (dataPoint.Label.Length > 0))
										{
											flag = true;
										}
										continue;
									}
								}
							}
						}
					}
				}
				if (flag)
				{
					foreach (object obj3 in list2)
					{
						DataPoint3D pointEx = (DataPoint3D)obj3;
						DataPoint point2 = pointEx.dataPoint;
						Series series4 = point2.series;
						Axis axis3 = area.GetAxis(AxisName.Y, series4.YAxisType, series4.YSubAxisName);
						Axis axis4 = area.GetAxis(AxisName.X, series4.XAxisType, series4.XSubAxisName);
						double viewMaximum = this.GetYValue(common, area, series4, pointEx.dataPoint, pointEx.index - 1, 0);
						if (viewMaximum > axis3.ViewMaximum)
						{
							viewMaximum = axis3.ViewMaximum;
						}
						if (viewMaximum < axis3.ViewMinimum)
						{
							viewMaximum = axis3.ViewMinimum;
						}
						viewMaximum = axis3.GetLogValue(viewMaximum);
						double yPosition = pointEx.yPosition;
						double num12 = viewMaximum - axis3.GetLogValue(this.GetYValue(common, area, series4, pointEx.dataPoint, pointEx.index - 1, -1));
						double height = pointEx.height;
						RectangleF rectangle = RectangleF.Empty;
						try
						{
							rectangle.X = (float)(pointEx.xPosition - (pointEx.width / 2.0));
							rectangle.Width = (float)pointEx.width;
							if (height < yPosition)
							{
								rectangle.Y = (float)height;
								rectangle.Height = ((float)yPosition) - rectangle.Y;
							}
							else
							{
								rectangle.Y = (float)yPosition;
								rectangle.Height = ((float)height) - rectangle.Y;
							}
						}
						catch (OverflowException)
						{
							continue;
						}
						if (!point2.IsEmpty && !selection)
						{
							double num14 = pointEx.indexedSeries ? ((double)pointEx.index) : point2.XValue;
							num14 = axis4.GetLogValue(num14);
							if ((((num14 < axis4.ViewMinimum) || (num14 > axis4.ViewMaximum)) || ((viewMaximum < axis3.ViewMinimum) && (num12 < axis3.ViewMinimum))) || ((viewMaximum > axis3.ViewMaximum) && (num12 > axis3.ViewMaximum)))
							{
								continue;
							}
							this.DrawLabels3D(common, graph, area, pointEx, pointEx.index - 1, series4, rectangle);
						}
					}
				}
			}
		}

		public virtual bool ApplyPaletteColorsToPoints
		{
			get
			{
				return false;
			}
		}

		public bool CircularChartArea
		{
			get
			{
				return false;
			}
		}

		public virtual bool DataPointsInLegend
		{
			get
			{
				return false;
			}
		}

		public virtual bool ExtraYValuesConnectedToYAxis
		{
			get
			{
				return false;
			}
		}

		public virtual bool HundredPercent
		{
			get
			{
				return false;
			}
		}

		public virtual bool HundredPercentSupportNegative
		{
			get
			{
				return false;
			}
		}

		public virtual string Name
		{
			get
			{
				return "StackedColumn";
			}
		}

		public virtual bool RequireAxes
		{
			get
			{
				return true;
			}
		}

		public virtual bool SecondYScale
		{
			get
			{
				return false;
			}
		}

		public bool SideBySideSeries
		{
			get
			{
				return false;
			}
		}

		public virtual bool Stacked
		{
			get
			{
				return true;
			}
		}

		public bool StackSign
		{
			get
			{
				return true;
			}
		}

		public virtual bool SupportLogarithmicAxes
		{
			get
			{
				return true;
			}
		}

		public virtual bool SupportStackedGroups
		{
			get
			{
				return true;
			}
		}

		public virtual bool SwitchValueAxes
		{
			get
			{
				return false;
			}
		}

		public virtual int YValuesPerPoint
		{
			get
			{
				return 1;
			}
		}

		public virtual bool ZeroCrossing
		{
			get
			{
				return true;
			}
		}
	}
}

